<template>
  <div class="page_padding evalute_page" ref="container">
    <MyNavBar class="nav" @goback="goback" :title="needDealName || $route.query.title"></MyNavBar>
    <StatisticTab :statisticInfo="statisticInfo">
      <div slot="btn" class="btn-box">
        <div
          v-if="statisticInfo.numNoSub > 0"
          class="urge"
          :class="{ inform: statisticInfo.isUrgeAll != '0', no_nform: statisticInfo.isUrgeAll == '0' }"
          @click="urgeSub('2')">
          {{ statisticInfo.isUrgeAll == '0' ? '已催报' : '全部催报' }}
        </div>
        <div v-if="statisticInfo.numNoSub == 0 && statusValue != 3" class="subbmit_btn" @click="subbmitAll">
          提交结果
        </div>
      </div>
    </StatisticTab>
    <UserTab :roll-list="rollList" :user-list="userList" @deal-data="InfoTitTab" ref="userTab"></UserTab>
    <div class="cont-box" :class="{ big: statusValue == 1 || statusValue == 2 }">
      <!-- 底部tab -->
      <van-tabs
        v-if="rollList.length"
        ref="tabsec"
        :class="['info_dataList', { big: statusValue == 1 || statusValue == 2 }]"
        swipe-threshold="3"
        line-width="25"
        title-active-color="#d80a06"
        @click="clickTab"
        v-model="activeInfo">
        <!-- 打分详情 -->
        <van-tab v-if="statusValue == 2 || statusValue == 3" title="评分详情">
          <div class="cont_list" v-if="scoreContentFlag">
            <!-- 季度评分 -->
            <ScoreType
              :disabled="true"
              :scoreListDetail="scoreData || {}"
              showPage="evalute"
              :userInfo="userList[activePeoIndex]"
              :busSign="busSign"
              :otherList="otherLists"
              :quarterNow="quarterNow"
              :groupByLeader="groupByLeader"
              :assessMode="assessMode" />
          </div>
        </van-tab>
        <van-tab title="季度总结">
          <div class="box" v-if="hasSummary">
            <van-row class="dataList_cont" v-for="(item, index) in quarterData" :key="index">
              <van-col span="24" v-if="!(item.personality && !item.cont)">
                <span class="dataList_tit title-text">{{ item.titName }}</span>
                <p class="dataList_conts" v-html="removeHtmlStyle(item.cont) || '未填写'"></p>
              </van-col>
            </van-row>
            <!-- 问题建议 -->
            <div class="suggestion_box">
              <div class="suggestion" v-for="(item, i) in suggestionList" :key="'a' + i">
                <div class="suggestion_info" v-for="(items, index) in item.suggestionData" :key="'b' + index">
                  <BoardSimple
                    :listData="items"
                    :title="suggestionList.length > 1 ? i + 1 : ''"
                    :entry="false"
                    :showWord="true"></BoardSimple>
                </div>
                <div class="suggestion_annex" v-if="item.suggestionalbumList.length > 0">
                  <div class="img_video">
                    <ImgUpload
                      v-bind:albumList.sync="item.suggestionalbumList"
                      :entry="false"
                      :showImg="false"
                      @changeAlive="changeAlive" />
                  </div>
                </div>
              </div>
            </div>
            <div class="img_video">
              <div class="list_text_title">
                <span class="text title-text">图片/视频/附件</span>
              </div>
              <div v-if="albumList.length > 0" class="up_box">
                <ImgUpload
                  class="PicturePreview"
                  v-if="albumList.length > 0"
                  :albumList="albumList"
                  :entry="false"
                  @changeAlive="changeAlive" />
              </div>
              <div v-else>
                <p class="dataList_conts">暂无数据</p>
              </div>
            </div>
          </div>
          <van-empty v-else class="custom-image" description="暂无数据" />
        </van-tab>
        <van-tab title="月小结">
          <div class="spot_con" v-if="hasSummary">
            <div class="spot_list" v-for="item in yearsAssessList" :key="item.id" @click="skipMonthAssess(item)">
              <div class="spot_list_text">
                <div class="spot_list_con">
                  <div class="list_title">{{ item.title }}</div>
                  <!-- <div class="list_con_text">{{ item.boundsRemark }}</div> -->
                </div>
                <div class="spot_list_type" :class="item.saveStatus == 1 ? 'complete' : 'hang'">
                  <!-- 状态 1为已完成，0为未完成，" -->
                  <span v-if="item.saveStatus == 1">已完成</span>
                  <span v-if="item.saveStatus == 0">未完成</span>
                </div>
              </div>
            </div>
            <van-empty v-if="yearsAssessList.length == 0" class="custom-image" description="暂无数据" />
          </div>
          <van-empty v-else class="custom-image" description="暂无数据" />
        </van-tab>
        <van-tab title="周纪实">
          <div class="spot_con" v-if="hasSummary">
            <div v-if="weekList.length > 0">
              <div class="spot_list" v-for="item in weekList" :key="item.id" @click="skipweekDetail(item)">
                <div class="spot_list_text">
                  <div class="spot_list_con">
                    <div class="list_title">{{ item.title }}</div>
                    <!-- <div class="list_con_text">{{ item.boundsRemark }}</div> -->
                  </div>
                  <div class="spot_list_type" :class="item.saveStatus == 1 ? 'complete' : 'hang'">
                    <span v-if="item.saveStatus == 1">已完成</span>
                    <span v-if="item.saveStatus == 0">未完成</span>
                  </div>
                </div>
              </div>
            </div>
            <van-empty v-if="weekList.length == 0" class="custom-image" description="暂无数据" />
          </div>
          <van-empty v-else class="custom-image" description="暂无数据" />
        </van-tab>
      </van-tabs>
    </div>
    <!-- 底部tab end -->
    <template v-if="busSign.includes('DEAL_LEADER_ASSESS')">
      <div class="fead_boot" v-if="statusValue == 1 || statusValue == 2">
        <div class="exit_btn btn_li" @click="exitEdit()" v-if="statusValue == 1 && isReturn === '1'">
          <span>退回修改</span>
        </div>
        <div class="btn_li" @click="skipScore('simple')">
          <span v-if="statusValue == 2">编 辑</span>
          <span v-if="statusValue == 1">领导评价</span>
        </div>
        <div class="btn_li" @click="batchData('batch')" v-if="Number(statisticInfo.numAll) > 1 && assessMode !== 1">
          <span>批量评价</span>
        </div>
      </div>
      <div class="fead_boot" v-else-if="statusValue == 0">
        <div class="btn_li" @click="urgeSub('1')" :style="isUrgeValue == '0' ? 'background: #D7D7D7;' : ''">
          <span v-if="isUrgeValue == '0'">已催报</span>
          <span v-else>催报</span>
        </div>
      </div>
    </template>
    <template v-if="busSign.includes('DEAL_MAIN_LEADER_ASSESS')">
      <div class="fead_boot" v-if="statusValue == 1 || statusValue == 2">
        <div class="btn_li" @click="skipScore()" v-if="!groupByLeader">
          <span v-if="statusValue == 2">编 辑</span>
          <span v-else>领导评价</span>
        </div>
        <div class="btn_li" @click="batchData('batch')" v-if="Number(statisticInfo.numAll) > 1">
          <span>批量评价</span>
        </div>
      </div>
      <div class="fead_boot" v-else-if="statusValue == 0">
        <div class="btn_li" @click="urgeSub('1')" :style="isUrgeValue == '0' ? 'background: #D7D7D7;' : ''">
          <span v-if="isUrgeValue == '0'">已催报</span>
          <span v-else>催报</span>
        </div>
      </div>
    </template>

    <van-popup class="popu" round v-model="popupShow" closeable position="bottom">
      <div class="pop_box">
        <van-field
          v-model="confirmSuggestion"
          rows="3"
          autosize
          label=""
          type="textarea"
          placeholder="请输入退回原因" />
        <div class="pop_btn">
          <div class="btn_li" @click="cancelExtraParmas()">取消</div>
          <div class="btn_li btn_sure" @click="postExtraParmas()">确定退回</div>
        </div>
      </div>
    </van-popup>

    <van-dialog
      v-model="subbmitShow"
      title="提醒"
      show-cancel-button
      @confirm="onSubbmit"
      @cancle="subbmitShow = 'false'">
      <div class="message">{{ tipMessage }}</div>
      <OtherTable :otherList="otherLists" :assessMode="assessMode"></OtherTable>
    </van-dialog>
  </div>
</template>

<script>
import { mapGetters } from 'vuex'
import MyNavBar from '@com/MyNavBar'
import BoardSimple from '@com/BoardSimple'
import MyVoice from '@com/MyVoice'
import ScoreType from './components/ScoreType'
import BoardSound from '@com/BoardSound'
import ImgUpload from '@com/ImgUpload'
import OtherTable from './components/OtherTable'
import StatisticTab from './components/StatisticTab.vue'
import UserTab from './components/UserTab'
import {
  getScoreQuarterRecordForm,
  getFirstAssessData,
  getScoreSideBarRecordForm,
  getAssessContent,
  submitAllAssess,
  getUserAssessData,
  getCheckSubmitAllAssess,
  getListAssessContent,
  chooseGoodConfig,
} from '@api/api-comment.js'
import { saveUrgeByNeedDeal, saveReturn } from '@api/api-documentary.js'
export default {
  name: 'evaluate',
  components: {
    MyNavBar,
    MyVoice,
    ImgUpload,
    BoardSimple,
    ScoreType,
    BoardSound,
    OtherTable,
    StatisticTab,
    UserTab,
  },
  props: {},
  data() {
    return {
      needDealName: '', //页面标题
      activePeo: '',
      activeInfo: 0,
      rollList: [],
      yearsAssessList: [], //月度考核
      weekList: [], //周纪实
      statisticInfo: {
        numAll: 0, // 总人数
        numNo: 0, // 未评
        numHas: 0, // 已评
        numNoSub: 0, // 未提交
        isUrgeAll: '', // 是否催报
      },
      albumList: [],
      quarterData: [],
      statusValue: 1,
      isUrgeValue: '0',
      enclosureList: [], //附件
      noteId: '',
      recordType: this.$route.query.recordType, //01-02 月度 01-03 季度
      saScoringId: '',
      busSign: this.$route.query.busSign, //二级tab
      scoreList: {}, //打分列表
      recordReplyShow: false,
      requestType: '0', //请求用户类型 1表示已评议
      popupShow: false,
      confirmSuggestion: '',
      hasSummary: true, // 是否提交从而展示数据
      suggestionList: [],
      processInstanceId: '',
      taskId: '',
      subbmitShow: false,
      scoreData: {},
      userList: [],
      tipMessage: '',
      activePeoIndex: 0,
      otherList: [],
      otherLists: [],
      subbmitSatus: 0,
      scoreContentFlag: false,
      groupByLeader: false, // 是否按领导分组展示信息
      quarterNow: 0, // 当前评价所属季度
      isReturn: '',
      assessMode: 2, //  1 指标 2综合
    }
  },
  computed: {
    ...mapGetters(['activeEvaluation']),
  },
  created() {},
  mounted() {},
  watch: {
    scoreList: {
      handler(news) {
        this.scoreData = news
      },
      deep: true,
    },
    activeEvaluation: {
      handler(news) {
        this.userList = news
        this.otherList = news
        this.setTopNum()
      },
      deep: true,
    },
    otherList: {
      handler(news) {
        this.otherLists = news
      },
      deep: true,
    },
    needDealName: {
      handler(news) {
        if (!this.groupByLeader) return
        if (news.indexOf('第一季度') !== -1) {
          this.quarterNow = 0
        } else if (news.indexOf('第二季度') !== -1) {
          this.quarterNow = 1
        } else if (news.indexOf('第三季度') !== -1) {
          this.quarterNow = 2
        } else if (news.indexOf('第四季度') !== -1) {
          this.quarterNow = 3
        }
      },
      immediate: true,
    },
  },
  activated() {
    if (sessionStorage.getItem('activeInfo')) {
      let data = JSON.parse(sessionStorage.getItem('activeInfo'))
      this.activePeo = data.activePeo
      this.activePeoIndex = data.activePeoIndex
    }
    if (this.activeInfo == 0 && this.busSign && this.noteId) {
      this.statusValue = this.userList[this.activePeoIndex].status
      this.noteId = this.userList[this.activePeoIndex].noteId
      if (String(this.statusValue) === '2') {
        this.getAssessContent('1')
      }
      sessionStorage.removeItem('activeInfo')
    }
    if (this.$store.state.alive) {
      this.resizePage()
    } else {
      this.getPageGradeDataList('0')
    }
  },
  deactivated() {},
  methods: {
    resizePage() {
      this.resizeData()
      this.$store.commit('setActiveNeedId', this.$route.query.needId)
      this.saScoringId = this.$route.query.saScoringId
      this.processInstanceId = this.$route.query.processInstanceId
      this.taskId = this.$route.query.taskId
      this.requestType = this.$route.query.requestType ? this.$route.query.requestType : '0'
      this.hasSummary = true
      this.getPageGradeDataList('0')
    },
    resizeData() {
      this.rollList = []
      this.noteId = ''
      this.saScoringId = ''
      this.activeInfo = 0
      this.activePeo = ''
    },
    InfoTitTab({ item, index }) {
      this.scoreContentFlag = false
      this.scoreList = {}
      this.activeInfo = 0
      this.activePeo = item.userId
      this.dealData(index)
    },
    clickTab(name, title) {
      // if (title == '评分详情') {
      //   this.getAssessContent('1')
      // }
    },

    getPageGradeDataList(count) {
      if (this.busSign.includes('DEAL_LEADER_ASSESS')) {
        this.getFirstAssessData(count)
      } else {
        this.getUserAssessData(count)
      }
    },
    getGradeLists() {
      //底部tab
      let that = this
      that.quarterData = []
      getScoreQuarterRecordForm({
        userId: that.activePeo,
        needId: that.$route.query.needId,
      }).then(res => {
        //季度自评
        that.quarterData.push(
          { titName: '季度个人总结', cont: res.data.workCon },
          { titName: '教育培训情况', cont: res.data.eduCon },
          { titName: '奖惩情况', cont: res.data.rpCon }
        )
        let list = res.data.proConList || []
        that.suggestionList = []
        list.forEach(item => {
          that.suggestionList.push({
            suggestionData: [
              {
                id: '',
                title: '',
                entryCont: item.proCon,
                audioList: item.proAudioList,
                isAt: true,
                wordLimit: 300,
              },
            ],
            suggestionalbumList: item.proFileList,
            suggestionId: item.id,
          })
        })
        that.enclosureList = res.data.recordFileList
        that.albumList = res.data.recordFileList
        that.albumList.push(...this.enclosureList)
      })
    },
    getYearsLists(type) {
      getScoreSideBarRecordForm({
        needId: this.$route.query.needId,
        actType: type,
        userId: this.activePeo,
      }).then(res => {
        if (type == '01-01') {
          //周纪实
          this.weekList = res.data
        } else if (type == '01-02') {
          //月度考核
          this.yearsAssessList = res.data
        }
      })
    },
    skipweekDetail(item) {
      if (item.saveStatus == 1) {
        this.$store.state.alive = false
        const url = item.url + '&isEnd=true'
        this.$router.push(url)
        // this.$router.push({ path: '/boarddetail', query: { id: item.noteId, isEnd: true, recordType: '01-01' } })
      } else {
        this.$toast.fail('周纪实未完结')
      }
    },
    goback() {
      this.$store.state.alive = true
      this.resizeData()
      this.$router.go(-1)
    },
    skipScore(type) {
      let path = ''
      if (type === 'batch') {
        path = this.groupByLeader ? '/ScoreNewsOnlyGroup' : '/ScoreNewsOnly'
      } else {
        path = '/ScoreNews'
      }
      this.$router.push({
        path: path,
        query: {
          saScoringId: this.saScoringId,
          recordType: this.recordType,
          noteId: this.noteId,
          busSign: this.busSign,
          btn: true,
          processInstanceId: this.processInstanceId,
          taskId: this.taskId,
          needId: this.$route.query.needId,
          activePeo: this.activePeo,
          status: this.statusValue,
          needDealName: this.needDealName,
          scoringMode: this.userList[this.activePeoIndex].scoringRadio,
          activePeoIndex: this.activePeoIndex,
          isUrgeValue: this.isUrgeValue,
        },
      })
    },
    // 打分详情
    getAssessContent(count) {
      getAssessContent({
        busSign: this.busSign,
        noteId: this.noteId,
        needId: this.$route.query.needId,
      }).then(res => {
        const data = res.data
        this.scoreList = data
        this.userList[this.activePeoIndex].extraData.entryCont = data.scoringExpressionVO?.expression || ''
        this.userList[this.activePeoIndex].extraData.audioList = data.scoringExpressionVO?.voiceList || []
        this.userList[this.activePeoIndex].reviewsaData.entryCont = data.scoringSuggestVO?.suggestion || ''
        this.userList[this.activePeoIndex].reviewsaData.audioList = data.scoringSuggestVO?.voiceList || []
        this.userList[this.activePeoIndex].scoringRadio = data.scoringMode || ''
        this.$store.commit('setActiveEvaluation', this.userList)
        this.scoreContentFlag = true
      })
    },
    // 月小结退回修改
    exitEdit() {
      this.popupShow = true
    },
    // 取消修改
    cancelExtraParmas() {
      this.confirmSuggestion = ''
      this.popupShow = false
    },
    // 退回修改
    postExtraParmas() {
      let that = this
      let params = {
        noteId: that.noteId,
        replayContent: that.confirmSuggestion,
        optionUserId: localStorage.userId,
        tenantId: localStorage.tenantId,
        suggestionList: [],
      }
      that.popupShow = false

      // 季度总结退回
      saveReturn(params).then(res => {
        if (res.code === 0) {
          that.popupShow = false
          that.confirmSuggestion = ''
          if (that.statisticInfo.numAll == '1') {
            that.$router.go(-1)
          } else {
            that.resizePage()
          }
        }
      })
    },
    // 催报
    urgeSub(type) {
      let that = this
      if (type === '2') {
        if (that.statisticInfo.isUrgeAll == '0') {
          return
        }
      } else if (type === '1') {
        if (that.isUrgeValue == '0') {
          return
        }
      }
      that.goUrge(type)
    },
    // 催报
    goUrge(type) {
      let that = this
      let message = '您确定要进行催报吗？'
      if (type === 2) {
        let arrUN = this.otherList.filter(item => {
          return item.status == 0
        })
        if (arrUN.length > 0) {
          let arr = []
          arrUN.forEach(item => {
            arr.push(item.userName)
          })
          message = `本季度个人工作汇总未完成人员 ${arr.join('、')}，您确定要进行催报吗？`
        }
      }
      that.$dialog
        .confirm({
          title: '提示',
          message: message,
        })
        .then(() => {
          saveUrgeByNeedDeal({
            needId: this.$route.query.needId,
            type: Number(type),
            urgeUserId: that.activePeo,
            optionUserId: localStorage.userId,
            tenantId: localStorage.tenantId,
          })
            .then(res => {
              if (res.status === 200) {
                if (type === '1') {
                  that.isUrgeValue = '0'
                  this.$refs.userTab.changeUserUrge(this.activePeo)
                  that.getPageGradeDataList('urge')
                } else {
                  that.resizePage()
                }
              }
            })
            .catch(err => {})
        })
        .catch(() => {
          // on cancel
        })
    },
    changeAlive() {
      this.$store.state.alive = false
    },
    removeHtmlStyle(html) {
      let rel = /style\s*?=\s*?([‘"])[\s\S]*?\1/g
      let newHtml = ''
      if (html) {
        newHtml = html.replace(rel, '')
      }
      return newHtml
    },
    skipMonthAssess(item) {
      if (item.saveStatus == 1) {
        this.$store.state.alive = false
        const url = item.url + '&isEnd=true'
        this.$router.push(url)
        // this.$router.push({ path: '/boarddetail', query: { id: item.noteId, isEnd: true, recordType: '01-02' } })
      } else {
        this.$toast.fail('月小结未完结')
      }
    },
    subbmitAll() {
      if (this.statisticInfo.numAll !== this.statisticInfo.numHas) {
        this.tipMessage = `还有${this.statisticInfo.numAll - this.statisticInfo.numHas}人未评价，请完成评价后再提交结果`
        this.subbmitShow = true
      } else {
        getCheckSubmitAllAssess({
          isCheckGood: 1,
          needId: this.$route.query.needId,
        }).then(res => {
          if (res.status === 200) {
            this.subbmitSatus = res.data.status
            if (res.data.status == 0) {
              this.tipMessage = '您确定要提交所有评分吗？'
            } else {
              this.tipMessage = res.data.tips
            }
          }
          this.subbmitShow = true
        })
      }
    },
    onSubbmit() {
      if (this.subbmitSatus == 2 || this.statisticInfo.numAll !== this.statisticInfo.numHas) {
        this.subbmitShow = false
      } else {
        submitAllAssess({ needId: this.$route.query.needId, isCheckGood: 0 }).then(res => {
          if (res.status === 200) {
            this.$toast.success('提交结果成功')
            setTimeout(() => {
              this.$store.state.stateAlive = false
              this.$router.go(-1)
            }, 500)
          }
        })
      }
    },
    getFirstAssessData(count) {
      getFirstAssessData({
        needId: this.$route.query.needId,
        recordType: this.recordType,
        saScoringId: this.saScoringId || this.$route.query.saScoringId,
        busSign: this.busSign,
        requestType: this.requestType,
        keyWord: '',
        title: this.$route.query.title || '',
      }).then(res => {
        if (count === 'urge') {
          this.statisticInfo.isUrgeAll = res.data.isUrge
          return
        }
        this.assessMode = res.data.assessMode || 2
        this.otherList = res.data.userStatusVOList
        this.statisticInfo.isUrgeAll = res.data.isUrge
        this.needDealName = res.data.title || res.data.userStatusVOList[0].needDealName
        if (count == 0) {
          let arr = res.data.userStatusVOList
          arr.forEach(li => {
            if (li.userCategory == 2 || li.userCategory == 3) {
              li.isLeaderAssessDataResponseVOS = true
            } else {
              li.isLeaderAssessDataResponseVOS = false
            }
          })
          this.rollList = arr
          this.activeInfo = 0
          if (this.$route.query.userId) {
            for (let i = 0; i < this.rollList.length; i++) {
              if (this.rollList[i].userId === this.$route.query.userId) {
                this.dealData(i)
                break
              }
            }
          } else {
            this.dealData(0)
          }
          this.dealUserDataList(this.rollList)
        }
      })
    },
    getUserAssessData(count) {
      getUserAssessData({
        needId: this.$route.query.needId,
      }).then(res => {
        if (count === 'urge') {
          this.statisticInfo.isUrgeAll = res.data.isUrge
          return
        }
        let data = res.data
        this.groupByLeader = data.isGroupByLeader === 1 ? true : false
        this.needDealName = data.title
        if (this.groupByLeader) {
          this.groupLeaderDeal(data)
          return
        }
        if (data.leaderAssessDataResponseVOS && data.leaderAssessDataResponseVOS.length > 0) {
          data.leaderAssessDataResponseVOS.forEach(item => {
            item.isLeaderAssessDataResponseVOS = true
          })
        } else {
          data.leaderAssessDataResponseVOS = []
        }
        let arr = data.leaderAssessDataResponseVOS.concat(data.userAssessDataResponseVOS)
        this.otherList = arr
        this.statisticInfo.isUrgeAll = data.isUrge
        if (count == 0) {
          this.rollList = arr
          this.activeInfo = 0
          if (this.$route.query.userId) {
            for (let i = 0; i < this.rollList.length; i++) {
              if (this.rollList[i].userId === this.$route.query.userId) {
                this.dealData(i)
                break
              }
            }
          } else {
            this.dealData(0)
          }

          this.dealUserDataList(this.rollList, data.isSetLeaderAssess)
        }
      })
    },
    dealUserDataList(list, isSetLeaderAssess) {
      list.forEach(item => {
        item.extraData = {
          id: '',
          title: '',
          entryCont: '',
          audioList: [],
        }
        item.reviewsaData = {
          id: '',
          title: '',
          entryCont: '',
          audioList: [],
        }
        item.scoringRadio = ''
      })
      if (isSetLeaderAssess === 1) {
        list.forEach(item => {
          if (!item.mainLeaderAssessRank && item.leaderAssessRank) {
            item.mainLeaderAssessRank = item.leaderAssessRank
            item.mainLeaderAssessScore = item.leaderAssessScore
          }
        })
      }
      this.$store.commit('setActiveEvaluation', list)
    },
    batchData() {
      let noSubmitData = [],
        submitData = []
      noSubmitData = this.userList.filter(item => {
        return item.status == '0'
      })
      submitData = this.userList.filter(item => {
        return item.status != '0'
      })
      this.noSubmitData = noSubmitData
      if (submitData.length > 0) {
        let arrParm = []
        submitData.forEach(item => {
          arrParm.push({
            busSign: item.busSign || this.busSign,
            noteId: item.noteId,
          })
        })
        getListAssessContent(arrParm).then(res => {
          if (res.status === 200) {
            let data = res.data
            let arr = []
            data.map((li, index) => {
              li.extraData = {
                entryCont: (li.scoringExpressionVO && li.scoringExpressionVO.expression) || '',
                audioList: (li.scoringExpressionVO && li.scoringExpressionVO.voiceList) || [],
              }
              li.reviewsaData = {
                entryCont: (li.scoringSuggestVO && li.scoringSuggestVO.suggestion) || '',
                audioList: (li.scoringSuggestVO && li.scoringSuggestVO.voiceList) || [],
              }
              arr.push({ ...submitData[index], ...li })
            })
            let arrNew = arr.concat(noSubmitData)
            this.$store.commit('setActiveEvaluation', arrNew)
            this.skipScore('batch')
          }
        })
      } else {
        let arrNew = noSubmitData
        this.$store.commit('setActiveEvaluation', arrNew)
        this.skipScore('batch')
      }
    },
    setTopNum() {
      let [total, noScoreNum, scoredNum, noSubmitNum] = [0, 0, 0, 0]
      this.userList.forEach(item => {
        total++
        if (item.status == 1) {
          noScoreNum++
        } else if (item.status == 2 || item.status == 3) {
          scoredNum++
        } else if (item.status == 0) {
          noSubmitNum++
        }
      })
      this.statisticInfo.numAll = total
      this.statisticInfo.numNo = noScoreNum
      this.statisticInfo.numHas = scoredNum
      this.statisticInfo.numNoSub = noSubmitNum
    },
    dealData(i) {
      this.$refs.userTab.changeUser(this.rollList[i].userId)
      this.activePeoIndex = i
      this.noteId = this.rollList[i].noteId
      this.activePeo = this.rollList[i].userId
      this.statusValue = this.rollList[i].status
      this.isUrgeValue = this.rollList[i].isUrge
      this.saScoringId = this.rollList[i].saScoringId
      this.processInstanceId = this.rollList[i].processInstanceId || ''
      this.taskId = this.rollList[i].taskId || ''
      this.isReturn = this.rollList[i].isReturn || ''
      // console.log('this.rollList[i] :>> ', this.rollList[i])
      if (String(this.statusValue) !== '0') {
        this.hasSummary = true
        this.getYearsLists('01-02') //月度评价/周纪实
        this.getYearsLists('01-01') //月度评价/周纪实
        this.getGradeLists() //月度自评/季度自评
        if (String(this.statusValue) === '2' || String(this.statusValue) === '3') {
          this.getAssessContent('0')
        }
      } else {
        this.hasSummary = false
      }
    },
    groupLeaderDeal(data) {
      let rollList = []
      let userListArr = data.leaderGroupUserAssessVOS || []
      userListArr.forEach(item => {
        item.userAssessDataResponseVOS.forEach(li => {
          li.extraData = {
            id: '',
            title: '',
            entryCont: '',
            audioList: [],
          }
          li.reviewsaData = {
            id: '',
            title: '',
            entryCont: '',
            audioList: [],
          }
          li.scoringRadio = ''
          if (data.isSetLeaderAssess === 1) {
            if (!li.mainLeaderAssessRank && li.leaderAssessRank) {
              li.mainLeaderAssessRank = li.leaderAssessRank
              li.mainLeaderAssessScore = li.leaderAssessScore
            }
          }
          li.leaderId = item.leaderId
          li.leaderName = item.leaderName
        })
        rollList.push(...item.userAssessDataResponseVOS)
      })

      this.rollList = rollList
      this.$store.commit('setActiveEvaluation', rollList)
      this.dealData(0)
    },
  },
  destroyed() {},
}
</script>
<style lang="scss" scoped>
.evalute_page {
  /deep/ .van-popup {
    position: absolute;
  }
  /deep/ .van-overlay {
    position: fixed;
  }
}
.page_padding {
  height: 100%;
  width: 100%;
  background-color: #f5f5f5;
  overflow: hidden;
  display: flex;
  flex-direction: column;

  .cont-tab::-webkit-scrollbar {
    display: none;
  }
  .cont-box {
    position: relative;
    flex: 1;
    overflow: hidden;
    .entry {
      background-color: #f7f7f7;
      padding-top: 8px;
      // 问题建议
      .problem {
        background-color: #fff;
        border-radius: 2px;
        min-height: 190px;
        .list {
          margin-bottom: 0;
          display: flex;
          justify-content: space-between;
          min-height: 190px;
          .list_text_box {
            // padding: 20px 0 20px 16px;
            .text {
              color: #333;
            }
            .voice_box {
              height: 100%;
              .translation_content {
                padding: 0 0 0 16px;
                line-height: 21px;
                font-size: 13px;
                color: #333333;
                margin-bottom: 10px;
              }
            }
          }
        }
        .list_voice_box {
          height: 100%;
          min-height: 190px;
          background: #f9f9f9;
          padding: 0 10px;
        }
        .list_text_title {
          font-size: 14px;
          color: #333;
          margin-bottom: 14px;
          margin-top: 14px;
          margin-left: 16px;
          .text {
            background-image: linear-gradient(#ffffff 50%, #f9f1e8);
          }
        }
      }
    }
    .img_video {
      padding: 0 16px;
      .list_text_title {
        font-size: 14px;
        margin-bottom: 14px;
        margin-top: 14px;
        .text {
          color: #a57d60;
          background-image: linear-gradient(#ffffff 50%, #f9f1e8);
        }
      }
      .dataList_conts {
        margin-top: 14px;
        line-height: 21px;
        @include ellipsis;
      }
      .up_box {
        display: flex;
        flex-wrap: wrap;
        padding-bottom: 8px;
        .empty_txt {
          color: #333333;
          font-size: 13px;
        }
        /deep/.up_li {
          width: 95px;
          height: 95px;
          background-color: #f8f8f8;
          border-radius: 1px;
          position: relative;
          margin-bottom: 8px;

          &:not(:nth-child(3n)) {
            margin-right: 12px;
          }

          display: flex;
          align-items: center;
          justify-content: center;
          flex-direction: column;
          color: #999999;
          font-size: 12px;

          .icon {
            font-size: 20px;
            color: #666666;
            margin-bottom: 10;
          }
          .text {
            font-size: 12px;
          }
          .up-img {
            width: 100%;
            height: 100%;
          }
          .close {
            position: absolute;
            width: 15px;
            height: 15px;
            border-radius: 50%;
            background-color: #999999;
            top: -6px;
            right: -6px;
            text-align: center;
            line-height: 16px;
            color: #ffffff;
            font-size: 7px;
          }

          .v_btn {
            position: absolute;
            left: 0;
            right: 0;
            top: 0;
            bottom: 0;
            margin: auto;
            width: 25px;
            height: 25px;
          }
        }
      }
    }

    .suggestion {
      padding: 0 16px;
      .list_text_title {
        font-size: 14px;
        color: #333;
        margin-top: 20px;
        .text {
          background-image: linear-gradient(#ffffff 50%, #f9f1e8);
        }
      }
      .entry_list {
        padding-bottom: 16px;
        .dataList_conts {
          margin-top: 14px;
          line-height: 21px;
          word-wrap: break-word;
        }
      }
    }
    /deep/.suggestion_box {
      .suggestion {
        padding: 0;
        .list_text_title {
          font-weight: normal;
          margin-bottom: 10px;
        }
        .list_text_box {
          padding-bottom: 0;
        }
      }
    }
  }
  .big {
    padding-bottom: 60px;
  }
  .oneTab {
    /deep/.van-tabs__nav {
      width: 35% !important;
    }
  }
  .towTab {
    /deep/.van-tabs__nav {
      width: 60% !important;
    }
  }
  .spot_con {
    padding: 0 16px;
    .spot_list {
      border-bottom: 1px solid #efefef;
      .spot_list_text {
        display: flex;
        justify-content: space-between;
        align-items: center;
        height: 60px;
        .spot_list_con {
          flex: 1;
          width: 0;
          display: flex;
          flex-direction: column;
          .list_title {
            // font-size: 14px;
            font-weight: bold;
            color: #333333;
          }
          .list_con_text {
            width: 100%;
            font-size: 12px;
            color: #666666;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
          }
        }
        .spot_list_type {
          height: 28px;
          border-radius: 2px;
          font-size: 13px;
          padding: 5px 10px;
          display: flex;
          justify-content: center;
          align-items: center;
          min-width: 65px;
          .clock {
            color: #e67f2b;
            margin-right: 3px;
          }
          // 已完成
          &.complete {
            background-color: transparent;
            color: #3fa83f;
          }
          // 未完成
          &.hang {
            background-color: rgba($color: #ff4343, $alpha: 0.1);
            color: #d91717;
          }
        }
      }
      .spot_list_tip {
        display: flex;
        justify-content: space-between;
        align-items: center;
        font-size: 12px;
        border-bottom: 1px solid #efefef;
        padding-bottom: 10px;
        .list_tip {
          display: flex;
          align-items: center;
          .tip {
            height: 40px;
            background-color: #fdf1dd;
            border-radius: 2px;
            display: flex;
            justify-content: center;
            align-items: center;
            margin-right: 10px;
            padding: 10px;
          }
        }
      }
    }
  }

  .info_dataList {
    width: 100%;
    display: flex;
    flex-direction: column;
    padding: 0 16px 14px;
    height: 100%;
    /deep/.van-tabs__wrap {
      .van-tabs__nav {
        background-color: #f5f5f5;
      }
      .van-tab {
        text-align: center;
        .van-tab__text {
          font-size: 16px;
        }
      }
      .van-tabs__nav {
        // width: 100%;
      }
      .van-tab--active .van-tab__text {
        font-size: 18px !important;
      }
    }
    /deep/.van-tabs__content {
      overflow-y: auto;
      flex: 1;
      background-color: #ffffff;
      border-radius: 5px;
      margin-top: 8px;
      padding-bottom: 10px;
    }
    .dataList_cont {
      padding: 10px 16px;
      .dataList_tit {
        color: #a57d60;
        background-image: linear-gradient(#ffffff 50%, #f9f1e8);
        font-size: 14px;
      }
      // 标题
      .list_text_title {
        font-size: 14px;
        font-weight: bold;
        margin-bottom: 15px;
        .text {
          color: #a57d60;
          background-image: linear-gradient(#ffffff 50%, #f9f1e8);
        }
      }
      // 学习活动标题
      .score_title {
        margin-top: 15px;
        display: flex;
        justify-content: space-between;
        .score_num {
          font-size: 16px;
          color: #c09144;
        }
      }
      .dataList_conts {
        margin-top: 14px;
        line-height: 21px;
        white-space: pre-wrap;
        .score_list_score {
          font-size: 14px;
          color: #b7904b;
        }
        .option_item {
          display: flex;
          justify-content: space-between;
          align-items: center;
          .option {
            height: 32px;
            width: 85px;
            font-size: 12px;
            color: #333333;
            display: flex;
            justify-content: center;
            align-items: center;
            border-radius: 6px;
            border: solid 2px #d5d5d5;
            position: relative;
            &.active {
              color: #c09144;
              border-color: #c09144;
            }
            &.iconduigou11:before {
              position: absolute;
              bottom: -1px;
              right: -12px;
              font-size: 40px;
            }
          }
          /deep/.van-radio__icon {
            height: auto;
          }
        }

        // 系统评分
        .sys_score {
          padding: 16px;
          box-shadow: 0px 2px 12px 0px rgba(204, 204, 204, 0.5);
          .sys_con {
            margin-top: 10px;
            .sys_list {
              display: flex;
              align-items: center;
              height: 30px;
              font-size: 12px;
              .spot {
                height: 5px;
                width: 5px;
                border-radius: 50%;
                background-color: #c09144;
              }
              .list_name {
                color: #666666;
                margin: 0 8px;
              }
              .list_num {
                // font-size: 14px;
                color: #c09144;
                font-weight: bold;
              }
            }
          }
        }

        .score_opera {
          padding: 16px;

          margin-top: 1px;
          .score_opera_con {
            margin-top: 10px;
            .con_title {
              color: #333333;
              // font-size: 14px;
            }
            .score_opera_radio {
              margin-top: 10px;
              .option_item {
                display: flex;
                justify-content: space-between;
                align-items: center;
                .option {
                  height: 32px;
                  width: 100px;
                  font-size: 12px;
                  color: #333333;
                  display: flex;
                  justify-content: center;
                  align-items: center;
                  border-radius: 6px;
                  border: solid 2px #d5d5d5;
                  position: relative;
                  &.active {
                    color: #c09144;
                    border-color: #c09144;
                  }
                  &.iconduigou11:before {
                    position: absolute;
                    bottom: -1px;
                    right: -12px;
                    font-size: 40px;
                  }
                }
                /deep/.van-radio__icon {
                  height: auto;
                }
              }
            }
          }
        }
      }
    }
    .cont_list {
      padding: 14px 0;
    }
  }
  // ----------------->
  .fead_boot {
    .exit_btn {
      background: #f5f5f5;
      color: #999999;
    }
  }
  .video_box {
    z-index: 999;
  }
  .pop_box {
    padding: 16px 0;
    /deep/.van-cell::after {
      border: 0;
    }
    .pop_btn {
      padding: 0 15px;
      height: 36px;
      display: flex;
      justify-content: space-around;
      .btn_li {
        height: 100%;
        width: 35%;
        background-color: #f5f5f5;
        border-radius: 5px;
        display: flex;
        align-items: center;
        justify-content: center;
        color: #999999;
      }
      .btn_sure {
        background-color: #0f61d5;
        color: #ffffff;
      }
    }
    /deep/ .van-field__body {
      margin-top: 15px;
      padding: 15px;
      .van-field__control {
        border: 1px solid #ccc;
        padding: 5px;
      }
    }
  }
  /deep/.van-icon-cross {
    color: #0f61d5;
  }
  .message {
    padding: 8px 14px 14px;
    text-align: center;
  }
}
.dia-content {
  font-size: 14px;
  p {
    margin: 10px 15px;
  }
  .person {
    color: #4a79ba;
  }
  .choose-btn {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 15px 0;
    span {
      padding: 5px 25px;
      border: 1px solid #dadce0;
      margin: 0 15px;
      border-radius: 5px;
      cursor: pointer;
    }
    .is_select {
      background-color: #f59a23;
      color: #ffffff;
      border-color: #f59a23;
    }
  }
  .tips {
    color: #d9110d;
    // font-size: 14px;
  }
}
</style>
